package org.example.core.aop;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.example.core.exception.ErrorException;

@Aspect
public class MybatisAspect {
    @Pointcut("execution(* org.apache.ibatis.executor.resultset.DefaultResultSetHandler.createResultObject())")
    public void pointCut(){

    }

    @Around("pointCut()")
    public Object around(ProceedingJoinPoint point){
        Object[] args = point.getArgs();
        try {
            return point.proceed(args);
        } catch (Throwable e) {
            throw new ErrorException(e.getMessage());
        }

    }
}
